decide if you want it for the medic, or the spy and go into their folder. take the materials folder and put it 
in team fortress 2/tf.

THEN take the model files of the hat you want it to replace and put them in either models/player/items/spy - or- medic

If you cant figure it out, go die.